package com.tree.shiro.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;

import javax.annotation.Generated;
import javax.persistence.*;
import java.util.List;

/**
 * @ClassName com.tree.shiro.entity
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 2019-06-25 22:15
 * @Version 1.0
 */
@Entity

public class Role {

    @Id
    @GenericGenerator(name="generator",strategy = "native")
    @GeneratedValue(generator = "generator")
    private Long id;

    @Column(nullable = false)
    private String name;

    @Column
    private String type;

//    @JsonIgnore
//    @ManyToMany(mappedBy = "roleList")
//    @JoinTable(name = "user_role", joinColumns = {@JoinColumn(name = "rid")},
//            inverseJoinColumns = {@JoinColumn(name = "uid")})
    @Transient
    private List<User> userList;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
}
